package yxy.cherry.battle.module.affix.buff;

import yxy.cherry.battle.Battle;
import yxy.cherry.battle.Fighter;
import yxy.cherry.battle.module.affix.AffixContext.AffixAction;
import yxy.cherry.battle.module.affix.AffixContext.AffixTarget;
import yxy.cherry.battle.module.affix.AffixFactory.BuffTypeEnum;
import yxy.cherry.battle.module.affix.Buff;
import yxy.cherry.battle.module.affix.BuffType;
import yxy.cherry.data.bean.skill;

import java.util.ArrayList;

/** 增伤 */
@BuffType(Type = BuffTypeEnum.增伤)
public class Affix_59_增伤 extends Buff {

	private int get增伤比例() {
		return getParam(0);
	}

	public Affix_59_增伤(Fighter source, Fighter target, skill skilldata, int[] params) {
		super(source, target, skilldata, params);
	}

	@Override
	public boolean exec(Fighter source, Fighter actor) {
		AffixAction affixAction = getAffixAction();

		AffixTarget affixTarget = affixAction.getTarget(affixAction.get针对目标());

		int overlay = 1;
		if(getOverlayMax() > 0){overlay = getOverlay();}

		ArrayList<Long> 伤害流 = affixTarget.get伤害流();
		ArrayList<Long> 结算伤害流 = genFinalDamage(伤害流, affixTarget.getBaseDamageList(), get增伤比例()*overlay);

		Battle.battleLogger(6,"Buff增伤：施法者："+source.getName()+"对象："+affixTarget.get目标().getName()+"原始伤害："+伤害流.toString()+"基本伤害："+affixTarget.getBaseDamageList().toString()+"增伤比例："+get增伤比例()+"叠加层数："+overlay+"最终伤害："+结算伤害流.toString());
		affixTarget.set伤害流(结算伤害流);

		return true;
	}

	@Override
	public BuffType getBuffType() {
		return BuffType.增益效果;
	}

	@Override
	public BuffStateType getBuffStateType() {
		return BuffStateType.增伤状态;
	}
}